<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>滨海基金 -工作日志</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<!-- Data Tables -->
<link href="css/plugins/dataTables/dataTables.bootstrap.css"
	rel="stylesheet">
<link href="css/animate.min.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/plugins/jeditable/jquery.jeditable.js"></script>
<script src="js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="js/My97DatePicker/WdatePicker.js"></script>
<script src="js/common.js"></script>
<style type="text/css">
/* dataTables列内容居中 */
.table>tbody>tr>td {
	text-align: center;
}
/* dataTables表头居中 */
.table>thead:first-child>tr:first-child>th {
	text-align: center;
}

.sel>select {
	width: 200px;
	height: 35px;
	float: left;
}

.sel {
	width: 100%;
	height: 50px;
	padding: 5px;
}
</style>
</head>
<body class="gray-bg">
	<div class="row">
		<div class="col-sm-12">
			<div class="ibox float-e-margins">
				<div class="ibox-title">
					<h5>工作日志</h5>

					<div class="ibox-content">
						<div class="sel" id="sel" style="display: none;" >
							<select class="form-control" style="width: 200px" id="company"
								onchange="cpmpanyChage(this.value)">
							</select> <select class="form-control" style="width: 150px" id="branch"
								onchange="branchChage(this.value)">
								<option value="">-请选择部门-</option>
							</select> <select class="form-control" style="width: 150px"
								onchange="Search()" id="team" onchange="">
								<option value="">-请选择团队-</option>
							</select>
						</div>
						<select class="form-control" onchange="selectDept(this.value)" id="select-dept"
							style="width: 100px; float: left;">
							<option value="1">个人</option>
							<!-- <option value="2">分公司(直属部门)报表</option>
					<option value="3">部门报表</option> -->
							<option value="4"
								style="<c:if test="${checkPower ==false}">display:none </c:if>">团队</option>
						</select> <select class="form-control" onchange="Search()"
							id="select-status" style="width: 100px; float: left;">
							<option selected="selected" value="all">全部</option>
							<option value="date">日报</option>
							<option value="week">周报</option>
							<option value="month">月报</option>
						</select>

						<div class="input-group col-md-3"
							style="margin-top: 0px positon:relative; float: left;">
							<input id="title" type="text" class="form-control "
								placeholder="请输入关键字（标题）"/ > <span
								class="input-group-btn">
								<button onclick="Search()" class="btn btn-info btn-search">查找</button>
								<button id="addDateReportBtn" class="btn btn-info btn-search"
									style="margin-left: 3px">添加</button> <!-- <button type="button" class="btn btn-info btn-search"
						data-toggle="dropdown" style="margin-left: 3px">
						添加 <span class="caret"></span>
					</button>
					<ul class="dropdown-menu" role="menu">
						<li><a href="#" id="addDateReportBtn"class="fa fa-file-o"> &nbsp;添加日报</a></li>
						<li><a href="#" id="addWeekReportBtn"class="fa fa-file-o"> &nbsp;添加周报</a></li>
						<li><a href="#" id="addMonthReportBtn"class="fa fa-file-o"> &nbsp;添加月报</a></li>
					</ul> -->
							</span>
						</div>


						<table
							class="table table-striped table-bordered table-hover dataTables-example"
							id="dataTables-example">
							<thead>
								<tr style="height: 30px">
									<th style="width: 50px" align="center">序号</th>
									<th style="width: 200px" align="center">标题</th>
									<th style="width: 100px" align="center">用户名</th>
									<th style="width: 150px" align="center">日期</th>
									<th style="width: 50px" align="center">周期</th>
									<th style="width: 50px" align="center">月份</th>
									<!-- <th style="width: 150px" align="center">所属分公司(直属部门)</th>
							<th style="width: 120px" align="center">所属部门</th> -->
									<th style="width: 50px" align="center">类型</th>
									<th style="width: 50px" align="center">状态</th>
									<th style="width: 50px" align="center">操作</th>
								</tr>
							</thead>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--添加日报模态框 -->
	<div class="modal fade  " id='addDateReportModal'>
		<div class="modal-dialog" style="width: 1000px; height: 600px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss='modal'>×</button>

					<h2 class="modal-title" align="center">添加工作日志</h2>
				</div>

				<div class="modal-body" align="center">

					<form class="form-horizontal m-t" id="myFrom"
						enctype="multipart/form-data">
						<div class="row form-body form-horizontal m-t">
							<div class="col-md-6 droppable sortable">
								<div class="form-group draggable" style="display: none;">
									<label class="col-sm-3 control-label">用户名： </label>
									<div class="col-sm-8">
										<input type="text" name="fillName" id="addDateReport-fillName"
											class="form-control" value="${loginUser.name }"
											disabled="disabled"> <input type="text" name="fillId"
											id="addDateReport-fillId" value="${loginUser.employeeId }"
											style="display: none;">
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-3 control-label">标题<span
										style="color: red;">&nbsp;*</span>：
									</label>
									<div class="col-sm-8">
										<input type="text" name="title" id="addDateReport-title"
											class="form-control">
									</div>
								</div>

							</div>
							<div class="col-md-6 droppable sortable">
								<div class="form-group draggable">
									<label class="col-sm-3 control-label">类型：</label>
									<div class="col-sm-8">
										<select class="form-control" name="status"
											id="addDateReport-status">
											<option value="1" selected="selected">日报</option>
											<option value="2">周报</option>
											<option value="3">月报</option>
										</select>
									</div>
								</div>
							</div>


							<div class="col-md-6 droppable sortable">
								<div class="form-group">
									<label class="col-sm-3 control-label">内容<span
										style="color: red;">&nbsp;*</span>：
									</label>
									<div class="col-sm-8">
										<textarea id="addDateReport-content" name="content" rows="20"
											cols="" class="form-control"
											style="width: 777px; height: 300px;resize: none;"></textarea>
									</div>
								</div>

							</div>

						</div>
					</form>
				</div>
				<div class="modal-footer" align="center">
					<div align="center">
						<button class="btn btn-primary" 
							onclick="addReport(1)">确认</button>
					</div>
				</div>
			</div>
		</div>
	</div>

	<!--详情模态框 -->
	<div class="modal fade  " id='detailReportModal'>
		<div class="modal-dialog" style="width: 1000px; height: 600px;">
			<div class="modal-content">
				<div class="modal-header">
					<button class="close" data-dismiss='modal'>×</button>

					<h2 class="modal-title" align="center">工作日志详情</h2>
				</div>

				<div class="modal-body" align="center">

					<form class="form-horizontal m-t" id="myFrom"
						enctype="multipart/form-data">
						<div class="row form-body form-horizontal m-t">
							<div class="col-md-6 droppable sortable">
								<div class="form-group draggable">
									<label class="col-sm-3 control-label">用户名： </label>
									<div class="col-sm-8">
										<input type="text" name="fillName" id="detail-fillName"
											class="form-control" disabled="disabled">
											<input type="hidden" name="dailyId" id="dailyId" >
									</div>
								</div>
								<div class="form-group draggable">
									<label class="col-sm-3 control-label">标题： </label>
									<div class="col-sm-8">
										<input type="text" name="title" id="detail-title"
											class="form-control" disabled="disabled">
									</div>
								</div>
								<!-- <div class="form-group draggable">
									<label class="col-sm-3 control-label">所属分公司(直属部门)： </label>
									<div class="col-sm-8">
										<input type="text" name="deptName" id="detail-deptName"
											class="form-control"  disabled="disabled">
									</div>
								</div> -->

								<div class="form-group draggable" id="detail-teamName1" >
									<label class="col-sm-3 control-label">批阅人： </label>
									<div class="col-sm-8">
										<input type="text" name="teamName" id="detail-teamName"
											class="form-control" disabled="disabled">
									</div>
								</div>
								<div class="form-group">
									<label class="col-sm-3 control-label">日志内容：</label>
									<div class="col-sm-8">
										<textarea id="detail-content" name="content" rows="20" cols=""
											class="form-control" style="width: 777px; height: 200px;resize: none;"
											disabled="disabled"></textarea>
									</div>
								</div>
								<div class="form-group" id="detail-readContent1" >
									<label class="col-sm-3 control-label">批阅内容：</label>
									<div class="col-sm-8">
										<textarea id="detail-readContent" name="readRemark" rows="20" cols=""
											class="form-control" style="width: 777px; height: 200px;resize: none;"
											disabled="disabled"></textarea>
									</div>
								</div>
							</div>
							<div class="col-md-6 droppable sortable">
								<div class="form-group draggable">
									<label class="col-sm-3 control-label"> 类型：</label>
									<div class="col-sm-8">
										<input type="text" name="status" id="detail-status"
											class="form-control" disabled="disabled">
									</div>
								</div>
								<div class="form-group draggable" id="detail-fillDate-div">
									<label class="col-sm-3 control-label">日期：</label>
									<div class="col-sm-8">
										<input type="text" name="fillDate" id="detail-fillDate"
											class="form-control"
											onClick="WdatePicker({lang:'zh-cn',dateFmt:'yyyy-MM-dd HH:mm:ss'})"
											placeholder="请输入日期"  disabled="disabled">
									</div>
								</div>
								<div class="form-group draggable" id="detail-cycle-div"
									style="display:">
									<label class="col-sm-3 control-label">周期： </label>
									<div class="col-sm-8">
										<input type="text" name="cycle" id="detail-cycle"
											class="form-control" disabled="disabled">
									</div>
								</div>
								<div class="form-group draggable" id="detail-month-div"
									style="display:">
									<label class="col-sm-3 control-label">月份： </label>
									<div class="col-sm-8">
										<input type="text" name="month" id="detail-month"
											class="form-control" disabled="disabled">
									</div>
								</div>
								<!-- <div class="form-group draggable">
									<label class="col-sm-3 control-label">所属部门： </label>
									<div class="col-sm-8">
										<input type="text" name="branchName" id="detail-branchName"
											class="form-control"  disabled="disabled">
									</div>
								</div> -->
							</div>


							<div class="col-md-6 droppable sortable"></div>

						</div>
					</form>
				</div>
				<div class="modal-footer" align="center">
					<div align="center">
						<button class="btn btn-primary" id="btnSubmit"
							onclick="closeModal(detailReportModal)">确认</button>
						<button class="btn btn-primary" id="readSubmit"
							onclick="readReport()">批阅</button>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
			var table;
			$(function() {
				//提示信息
				var lang = {
					"sProcessing" : "<span style=\"width:200px; text-align:ceter;padding:5px 25%\">处理中...</span>",
					"sLengthMenu" : "每页 _MENU_ 项",
					"sZeroRecords" : "没有匹配结果",
					"sInfo" : "当前显示第 _START_ 至 _END_ 项，共 _TOTAL_ 项。",
					"sInfoEmpty" : "当前显示第 0 至 0 项，共 0 项",
					"sInfoFiltered" : "(由 _MAX_ 项结果过滤)",
					"sInfoPostFix" : "",
					"sSearch" : "搜索:",
					"sUrl" : "",
					"sEmptyTable" : "表中数据为空",
					"sLoadingRecords" : "载入中...",
					"sInfoThousands" : ",",
					"oPaginate" : {
						"sFirst" : "首页",
						"sPrevious" : "上页",
						"sNext" : "下页",
						"sLast" : "末页",
						"sJump" : "跳转"
					},
					"oAria" : {
						"sSortAscending" : ": 以升序排列此列",
						"sSortDescending" : ": 以降序排列此列"
					}
				};

				//初始化表格
				table = $("#dataTables-example")
						.dataTable(
								{
									"fnDrawCallback" : function() {
										var api = this.api();
										var startIndex = api.context[0]._iDisplayStart;//获取到本页开始的条数
										api.column(0).nodes().each(
												function(cell, i) {
													cell.innerHTML = startIndex
															+ i + 1;
												});
									},
									language : lang, //提示信息
									autoWidth : false, //禁用自动调整列宽
									stripeClasses : [ "odd", "even" ], //为奇偶行加上样式，兼容不支持CSS伪类的场合
									processing : true, //隐藏加载提示,自行处理
									serverSide : true, //启用服务器端分页
									searching : false, //禁用原生搜索
									orderMulti : false, //启用多列排序
									order : [], //取消默认排序查询,否则复选框一列会出现小箭头
									renderer : "bootstrap", //渲染样式：Bootstrap和jquery-ui
									pagingType : "simple_numbers", //分页样式：simple,simple_numbers,full,full_numbers
									"aLengthMenu" : [ 10 ],
									"bLengthChange" : false,
									ordering : false, //关闭排序图标
									ajax : function(data, callback, settings) {
										//封装请求参数
										var param = {};
										param.limit = 10;//页面显示记录条数，在页面显示每页显示多少项的时候
										param.start = data.start;//开始的记录序号
										param.page = (data.start/data.length) + 1;//当前页码select-dept
										//param.darw=darw;  //计数器
										var title = $("#title")
												.val().trim();
										if (title != null
												&& title != "") {
											param.title = title
										}
										var selectDept = $("#select-dept").val().trim();
										if (selectDept != null && selectDept != "") {
											param.selectDept = selectDept
										}
										var selectStatus = $("#select-status").val().trim();
										if (selectStatus != null && selectStatus != "") {
											param.selectStatus = selectStatus
										}
										var checkPower = ${checkPower };
										param.checkPower = checkPower;
										if($("#select-dept").val()==4){
											param.deptId=$("#company").val();
											param.branchId=$("#branch").val();
											param.teamId=$("#team").val();
										}
										
										//ajax请求数据
										$.ajax({
													type : "POST",
													url : "getDailyList.do",
													cache : false, //禁用缓存
													data : param, //传入组装的参数
													dataType : "json",
													success : function(result) {

														//console.log(result);
														//setTimeout仅为测试延迟效果
														setTimeout(
																function() {
																	//封装返回数据
																	var returnData = {};
																	draw = result.draw;//后台返回的计数器
																	returnData.draw = data.draw;//这里直接自行返回了draw计数器,应该由后台返回
																	returnData.recordsTotal = result.total;//返回数据全部记录
																	returnData.recordsFiltered = result.total;//后台不实现过滤功能，每次查询均视作全部结果
																	returnData.data = result.data;//返回的数据列表
																	//console.log(returnData);
																	//调用DataTables提供的callback方法，代表数据已封装完成并传回DataTables进行渲染
																	//此时的数据需确保正确无误，异常判断应在执行此回调前自行处理完毕
																	callback(returnData);
																}, 200);
													}
												});
									},
									//列表表头字段
									columns : [ {
										"data" : null
									}, {
										"data" : "title"
									}, {
										"data" : "fillName"
									}, {
										"data" : "fillDate"
									}, {
										"data" : "cycle"
									}, {
										"data" : "month"
									},{
										"data" : function(data){
											var status = data.status;
											if(status == 1){
												return "日报";
											}
											else if(status == 2){
												return "周报";
											}
											else if(status == 3){
												return "月报";
											}
										}
									},
									{
										"data" : function(data) {
											if (data.readStatus == "0") {
												return "<span style=\"color:red;\" >未阅</span>";
											} else {
												return "已阅";
											}
										}
									}],
								columnDefs : [ {
										"targets" : [ 8 ], //第七列加一条 自定义列
										"data" : "dailyId", //数据列名
										"render" : function(data, type, full) { //返回自定义的内容

											return  "<a class=\"btn btn-info btn-xs\" onClick=\"detailReport("
													+ data
													+ ");\">详情</a> "
													/* + "<a class=\"btn btn-info btn-xs\" onClick=\"editTrip("
													+ data
													+ ");\">编辑</a> " */
													/* + "<a class=\"btn btn-info btn-xs\" onClick=\"delTrip("
													+ data + ");\">删除</a> " */;
										}
									} ]
								})//.api();	
								$("#addDateReportBtn").click(function() {
									var date = new Date();
									var month = date.getMonth() + 1;
								    var strDate = date.getDate();
								    if (month >= 1 && month <= 9) {
								        month = "0" + month;
								    }
								    if (strDate >= 0 && strDate <= 9) {
								        strDate = "0" + strDate;
								    }
							   		var currentdate = date.getFullYear() +''+ month + strDate;
							   		var title = '${loginUser.name }' + currentdate;
							   		$("#addDateReport-title").val(title);
									$("#addDateReport-content").val("");
									$("#addDateReportModal").modal("show");
								})
			})
			function Search() {
				/* var oSettings = table.fnSettings();  
				oSettings._iDisplayStart = 0;  
				table.fnDraw(oSettings);   */
				table.fnDraw();
			}
			
			function addReport(num) {
				var title;
				var status;
				var content;
				/* 从添加日报的模态框中获取数据 */
				title = $("#addDateReport-title").val();
				status = $("#addDateReport-status").val();
				content = $("#addDateReport-content").val();
				if (title != ""  && content != "") {	
					$.ajax({
						url: "addDaily.do",
						type: "post",
						data: {title:title,status:status,content:content},
						error : function(data) {
							swal("提交失败!", "日报提交提示!", "error");
						},
						success : function(data) {
							if (data.code == 1) {
								swal({
									 title: "提交成功",
						        	 text: "工作日志提交提示",
							         type: "success",
							         confirmButtonColor: "#DD6B55",
							         confirmButtonText: "确定",
							         closeOnConfirm: true	
								}, function () {
							    	Search()
							    	$("#addDateReportModal").modal("hide");
								});
							} else {
								swal("提交失败!", "工作日志提交提示!", "error");
							}
						}}); 
				} else {
					swal("请正确填写内容", "有必填项没填", "error");
				}
			}
			function readReport() {
					$.ajax({
						url: "readDaily.do",
						type: "post",
						data: {
							dailyId:$("#dailyId").val(),
							readRemark:$("#detail-readContent").val()
						},
						error : function(data) {
							swal("提示", "批阅失败", "error");
						},
						success : function(data) {
							if (data.code == 0) {
								swal({
									 title: "提示",
						        	 text: "批阅成功",
							         type: "success",
							         confirmButtonColor: "#DD6B55",
							         confirmButtonText: "确定",
							         closeOnConfirm: true	
								}, function () {
							    	Search()
							    	$("#detailReportModal").modal("hide");
								});
							} else {
								swal("提示", "批阅失败!", "error");
							}
						}}); 
			}
			/* 查看详细信息 */
			function detailReport(id) {
				$.ajax({
					url : "getDailyListById.do",
					data : {
						id : id
					},
					type : "post",
					dataType : "json",
					success : function(result) {
						if (result.code == 1) {
							$("#dailyId").val(result.daily.dailyId);
							$("#detail-fillName").val(result.daily.fillName);
							$("#detail-title").val(result.daily.title);
							$("#detail-fillDate").val(result.daily.fillDate);
							$("#detail-cycle").val(result.daily.cycle);
							$("#detail-month").val(result.daily.month);
							$("#detail-content").val(result.daily.content);
							$("#detail-deptName").val(result.daily.deptName);
							$("#detail-branchName").val(result.daily.branchName);
							if(result.daily.readStatus=='1'){
								$("#detail-teamName1").show();
								$("#detail-readContent1").show();
								$("#readSubmit").hide();
								$("#btnSubmit").show();
								$("#detail-readContent").attr("disabled","disabled");
								$("#detail-teamName").val(result.daily.readEmp.name);
								$("#detail-readContent").val(result.daily.readRemark);	
							}else{
								$("#detail-readContent").val(result.daily.readRemark);	
								if($("#select-dept").val()=="1"){
									$("#readSubmit").hide();
									$("#btnSubmit").show();
									$("#detail-readContent1").hide();
									$("#detail-readContent").attr("disabled","disabled");
									$("#detail-teamName1").hide();
								}else{
									$("#btnSubmit").hide();
									$("#readSubmit").show();
									$("#detail-teamName1").hide();
									$("#detail-readContent1").show();
									$("#detail-readContent").removeAttr("disabled");
								}
							}
							if(result.daily.status =='1'){
								$("#detail-status").val('日报');
								document.getElementById("detail-fillDate-div").style.display = '';
								document.getElementById("detail-cycle-div").style.display = 'none';
								document.getElementById("detail-month-div").style.display = 'none';
							}
							else if(result.daily.status =='2'){
								$("#detail-status").val('周报');
								document.getElementById("detail-fillDate-div").style.display = 'none';
								document.getElementById("detail-cycle-div").style.display = '';
								document.getElementById("detail-month-div").style.display = 'none';
							}
							else{
								$("#detail-status").val('月报');
								document.getElementById("detail-cycle-div").style.display = 'none';
								document.getElementById("detail-fillDate-div").style.display = 'none';
								document.getElementById("detail-month-div").style.display = '';
							}
							$("#detailReportModal").modal("show");
						} else {
							sweetAlert("提示", "获取失败!", "error");
						}

					},
					error : function() {
						sweetAlert("异常", "网络出现异常!", "error");
					}

				});
				
			}
		  //显示modal
		   function showModal(modal){
			   $(modal).modal("show");
		   }
   		 //隐藏modal
	      function closeModal(modal){
	    	  $(modal).modal("hide");
	      }
   		 function returnCurrentDate(){
   			 var date = new Date();
	   		 var currentdate = date.getFullYear() + (date.getMonth() + 1) + date.getDate();
	   		 return currentdate;
   		 }
   		 
   		function cpmpanyDept() {
   				$.ajax({
   					url : "getDeptInfo.do",
   					type : "post",
   					dataType : "json",
   					success : function(result) {
   						if (result.code == 0) {
   							var branchHtml = "";
   							for (var i = 0; i < result.data.length; i++) {
   								branchHtml += "<option value=\""
   										+ result.data[i].deptId + "\">"
   										+ result.data[i].deptName + "</option>";
   							}
   							$("#company").append(branchHtml);
   							$("#company").trigger("change");

   						} else {
   							sweetAlert("提示", "操作失败,请刷新后重试!", "error");
   						}
   					},
   					error : function() {
   						sweetAlert("异常", "网络出现异常!", "error");
   					}
   				});// ajax end;
   		}
   		function cpmpanyChage(id) {
   			if ($("#company").val() != "" && $("#company").val() != null) {
   				$.ajax({
   					url : "getBranchInfo.do",
   					type : "post",
   					data : {
   						id : id
   					},
   					dataType : "json",
   					success : function(result) {
   						if (result.code == 0) {
   							var branchHtml = "";
   							if(result.quarters!=2 && result.quarters!=1){
   								branchHtml += "<option value=\"\" >-请选择-</option>";
   							}
   							for (var i = 0; i < result.branch.length; i++) {
   								branchHtml += "<option value=\""
   										+ result.branch[i].branchId + "\">"
   										+ result.branch[i].branchName + "</option>";
   							}
   							$("#branch").empty();
   				   			$("#team").empty();
   							$("#branch").append(branchHtml);
   							$("#branch").trigger("change");

   						} else {
   							sweetAlert("提示", "未知异常!", "error");
   						}
   					},
   					error : function() {
   						sweetAlert("异常", "网络出现异常!", "error");
   					}
   				});// ajax end;
   			}else{
				$("#branch").empty();
				$("#branch").append("<option value=\"\" >-请选择-</option>");
				$("#branch").trigger("change");
			}
			
   		}
   		function branchChage(id) {  						
   			if ($("#branch").val() != "" && $("#branch").val() != null) {
   				$.ajax({
   					url : "getTeamInfo.do",
   					type : "post",
   					data : {
   						id : id
   					},
   					dataType : "json",
   					success : function(result) {
   						if (result.code == 0) {
   							var branchHtml = "";
   							if(result.quarters!=1){
   								branchHtml += "<option value=\"\" >-请选择-</option>";
   							}
   							for (var i = 0; i < result.data.length; i++) {
   								branchHtml += "<option value=\""
   										+ result.data[i].branchId + "\">"
   										+ result.data[i].branchName + "</option>";
   							}
   							$("#team").empty();
   							$("#team").append(branchHtml);
   							Search();
   						} else {
   							sweetAlert("提示", "未知异常!", "error");
   						}
   					},
   					error : function() {
   						sweetAlert("异常", "网络出现异常!", "error");
   					}
   				});// ajax end;
   			}else{
   				$("#team").empty();
   				$("#team").append("<option value=\"\" >-请选择-</option>");
   				Search();
   			}
   		
   		}
   		function selectDept(val){
   			if(val==4){
   				$("#sel").show();
   				cpmpanyDept(); 	
   			}else{
   				$("#sel").hide(); 			
   			}			
   		}
		</script>
</body>

</html>